package com.example.coursehub.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.example.coursehub.entity.WrongQuestionBankQuestion;
import com.example.coursehub.entity.WrongQuestionBankQuestionId;

public interface WrongQuestionBankQuestionRepository extends JpaRepository<WrongQuestionBankQuestion, WrongQuestionBankQuestionId>, JpaSpecificationExecutor<WrongQuestionBankQuestion> {
    // 修改方法名以正确引用关联实体的属性路径
    List<WrongQuestionBankQuestion> findByWrongQuestionBank_WrongQuestionBankId(String wrongQuestionBankId);
    
    // 1. 修复方法返回类型（应该返回WrongQuestionBankQuestion而不是FavoriteQuestionBankQuestion）
    // 2. 修改方法名以匹配实体结构
    Optional<WrongQuestionBankQuestion> findByWrongQuestionBank_WrongQuestionBankIdAndQuestion_QuestionId(String wrongQuestionBankId, String questionId);

    void deleteByQuestion_QuestionIdIn(List<String> questionIds);
}